Within my DXL script, how do I detect, per object, whether an enumerated type has multiple values? And then how do I capture them for output, say, to an Excel cell? Thanks, Tara tlwtheq - Tue Apr 23 08:29:39 EDT 2013 |
Re: Handling Enumerated Types
[1] If an object has more than one enumerated selected?
[1b] You can get a handle on the AttrType, get a list of legal enumerations, then loop through the obj.attr value using isMember
[2] There just HAS to be a better way, but years ago I came up with the following to export to MS-Word tables:
I have a "converter" macro which has to be coordinated with the holding patterns in the DXL. Having some difficulty with rich-text, searing for "\par ' and \'tab ' etc. [2b] Now if you "export" by opening Word or Excel and using OLE Cut/Paste for each cell, then I don't think you need the holding pattern, since I think it works like this:
None of my DXL does it that way however. -Louie |
Re: Handling Enumerated Types llandale - Tue Apr 23 09:52:05 EDT 2013
[1] If an object has more than one enumerated selected?
[1b] You can get a handle on the AttrType, get a list of legal enumerations, then loop through the obj.attr value using isMember
[2] There just HAS to be a better way, but years ago I came up with the following to export to MS-Word tables:
I have a "converter" macro which has to be coordinated with the holding patterns in the DXL. Having some difficulty with rich-text, searing for "\par ' and \'tab ' etc. [2b] Now if you "export" by opening Word or Excel and using OLE Cut/Paste for each cell, then I don't think you need the holding pattern, since I think it works like this:
None of my DXL does it that way however. -Louie Yeah, I was looking at isMember as a possible solution. I might do that and see how it turns out. Thanks, Louie! |
Re: Handling Enumerated Types Most of my DXL exports to Excel I now use the OleMethod, OlePut, etc functions to paste direct to an Excel cell, which effectively requires a string as the input. Regardless of the number of selected enumerations, using the probeAttr_(obj, NameMultiAttr) will return the string with each selected enumeration separated by a \n character which Excel interprets fine and in the outputted sheet you will see each enumeration on new lines within the cell |
Re: Handling Enumerated Types BenSharples - Thu May 02 05:16:22 EDT 2013 Most of my DXL exports to Excel I now use the OleMethod, OlePut, etc functions to paste direct to an Excel cell, which effectively requires a string as the input. Regardless of the number of selected enumerations, using the probeAttr_(obj, NameMultiAttr) will return the string with each selected enumeration separated by a \n character which Excel interprets fine and in the outputted sheet you will see each enumeration on new lines within the cell Oops forgot to mention: My "exporters" create the file system file with "Stream", then open the file with the application <system("../winword.exe NameFileJustCreated.rtf")>; then I use Word macro to create the file. Not sure this is "better" than the OLE method, but it is an order of magnitude faster. -Louie |
Re: Handling Enumerated Types llandale - Thu May 02 11:23:47 EDT 2013 Oops forgot to mention: My "exporters" create the file system file with "Stream", then open the file with the application <system("../winword.exe NameFileJustCreated.rtf")>; then I use Word macro to create the file. Not sure this is "better" than the OLE method, but it is an order of magnitude faster. -Louie Yes it is. And if you have your own invisible word in the background, the user is not disturbed by using his own word. You only have
Best regards Wolfgang |
Re: Handling Enumerated Types Wolfgang Uhr - Thu May 02 11:56:28 EDT 2013 Yes it is. And if you have your own invisible word in the background, the user is not disturbed by using his own word. You only have
Best regards Wolfgang ... and never have two scripts running at once and don't do any copy-cutting manually else you risk clobbering the system clip-board. You say the OLE method works with invisible Word target document? Didn't know that. That should speed things up considerably. -Louie My rich text exporter is indeed hopelessly convoluded; but I want the same routines to be able to send output to Attr-Values and Dialog Boxes as well. Part of the problem is that I want a "summary" at the top of the file, that gets generated only after the entire body is finished. Thinking out loud: instead of replacements for TAB and EOL characters intended inside a cell I can have replacements for TAB and EOL characters that are the bounderies between the cells. Accumulate everything in some Buffer, then the "exporter" reads the buffer, looking for these TAB and EOL replacement patterns to determine where to delimit the OLE copy-paste functions.... |
Re: Handling Enumerated Types llandale - Thu May 02 13:35:40 EDT 2013 ... and never have two scripts running at once and don't do any copy-cutting manually else you risk clobbering the system clip-board. You say the OLE method works with invisible Word target document? Didn't know that. That should speed things up considerably. -Louie My rich text exporter is indeed hopelessly convoluded; but I want the same routines to be able to send output to Attr-Values and Dialog Boxes as well. Part of the problem is that I want a "summary" at the top of the file, that gets generated only after the entire body is finished. Thinking out loud: instead of replacements for TAB and EOL characters intended inside a cell I can have replacements for TAB and EOL characters that are the bounderies between the cells. Accumulate everything in some Buffer, then the "exporter" reads the buffer, looking for these TAB and EOL replacement patterns to determine where to delimit the OLE copy-paste functions.... Hello Louie > You say the OLE method works with invisible Word target document? Didn't know that. Yes it does, I have tested it. Word may be invisible and in may be a separate word session. Both works well. Doors does some export and the user can work on his document, but > ... and never have two scripts running at once and don't do any copy-cutting manually else you risk clobbering the system clip-board. You must not use the clippboard. That is impossible, because this is the feature for the user. You have to use the range object to insert data. It's a little script redesign ... Best regards Wolfgang
|
Re: Handling Enumerated Types Wolfgang Uhr - Thu May 02 14:19:36 EDT 2013 Hello Louie > You say the OLE method works with invisible Word target document? Didn't know that. Yes it does, I have tested it. Word may be invisible and in may be a separate word session. Both works well. Doors does some export and the user can work on his document, but > ... and never have two scripts running at once and don't do any copy-cutting manually else you risk clobbering the system clip-board. You must not use the clippboard. That is impossible, because this is the feature for the user. You have to use the range object to insert data. It's a little script redesign ... Best regards Wolfgang
Sorry not following. I'm suggesting you cannot have two instances of the script running at once due to clipboard conflicts ... and your response is? -Louie Mental note: "Range" Object. |